package com.aliyun.messagemgt.common.enums;

/**
 * Created with IDEA
 * 推送结果用到的状态常量
 *
 * @author:zhangxingxing 0027012120
 * @date:2019/1/30
 * @time:15:38
 */
public enum PushResultEnum {

    //推送结果码
    PUSH_SUCCESS(1, "推送成功"),

    PUSH_ERROR(2, "推送失败"),

    SMS_PUSH_ERROR(7001, "SMS渠道推送错误"),

    ORG_RESOLVE_ERROR(101, "组织解析错误"),

    CHANNELINFO_EXIST_ERORR(201, "没有推送渠道信息"),

    CHANNEL_HANDLER_ERORR(202, "没有推送通道信息对应的处理方法"),

    MEDIA_TYPE_ERROR(301, "没有对应的Media类型"),

    URL_OVERLIMIT(302, "url资源大小超过限制"),

    URL_IO_ERORR(303, "url IO错误"),

    DUPLICATION_MSG_RESTRAIN(401, "重复消息抑制"),

    FLOW_OVER_LIMIT(501, "达到流控"),

    NO_RECEIVER(601, "无推送目标"),

    PUSH_TOKEN_INVALID(1001, "无法获取到token"),

    PUSH_MSG_INVALID(1002, "推送内容为空"),

    PUSH_DINGTALK_FAIL(1003, "钉钉推送失败"),

    PUSH_DINGTALK_FORBIDDEN(1004, "消息达到钉钉流控"),

    PUSH_SIGN_INVALID(1005, "无法获取到sign"),

    PUSH_ROBOT_ERROR_CODE(1006, "钉钉机器人发送消息失败"),

    PUSH_COMPANY_GROUP_ERROR_OA(1007, "钉钉企业群OA发送消息失败:缺失DingDingOa对象"),

    PUSH_COMPANY_GROUP_ERROR_INFO(1008, "无法获取到群信息!"),

    PUSH_COMPANY_GROUP_ERROR_CHATID(1009, "群聊 chatId 不存在!"),

    PUSH_DINGTALK_USER_NOTEXIT(1010, "找不到该用户"),

    PUSH_RECEIVE_RANGEINFO_ISNULL(1011, "无接收范围信息"),

    WEIXIN_USER_INVALID(2001, "微信用户无效"),

    WEIXIN_PUSH_ERROR(2002, "微信推送失败"),

    WECHAT_INVALID_TYPE_ERROR(2003, "微信不支持该多媒体文件格式"),

    WECHAT_INVALID_LENGTH_ERROR(2004, "该多媒体文件大小超出微信限制"),

    CONTENT_TYPE_ERROR(3001, "获取媒体类型失败"),

    DOCTOR_PUSH_ERROR(4001, "全科医生推送失败"),

    SYSTEM_PUSH_ERROR(5001, "系统端推送错误"),
    LANXIN_PUSH_ERROR(6001, "LANXIN端推送错误"),

    LAN_XIN_PLUS_PUSH_ERROR(6002, "蓝信+端推送错误"),;

    private Integer errorCode;

    private String description;

    public Integer getErrorCode() {
        return errorCode;
    }

    public String getDescription() {
        return description;
    }

    PushResultEnum(Integer errorCode, String description) {
        this.errorCode = errorCode;
        this.description = description;
    }

    public static PushResultEnum getEnumByErrorCode(Integer errorCode) {
        for (PushResultEnum pushResultEnum : PushResultEnum.values()) {
            if (pushResultEnum.getErrorCode().equals(errorCode)) {
                return pushResultEnum;
            }
        }
        return null;
    }
}
